import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout/Index.vue'
import Login from '@/views/login/Index.vue'
import Home from '@/views/home/Home.vue'


// 采购订单管理
const Order =()=>import('@/views/order/Index.vue')
const Order_Main_list =()=>import('@/views/order/list/main/Index.vue')
const Order_Sub_list =()=>import('@/views/order/list/sub/Index.vue')

// 入库单管理
const Store =()=>import('@/views/store/Index.vue')
const Store_main_list =()=>import('@/views/store/list/main/Index.vue')
const Store_sub_list =()=>import('@/views/store/list/sub/Index.vue')

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    component:Layout,
    children:[
      {
        path:'/',
        name:'home',
        // component:Home
        component: Order_Main_list
      },
      {
        path:'/order',  //采购订单管理
        name:'order',
        component:Order,
        children:[
          {
            path:'main_list',
            name:'main_list',
            component:Order_Main_list
          },
          {
            path:'sub_list',
            name:'sub_list',
            component:Order_Sub_list
          }
        ]
      },
      {
        path:'/store',  //采购订单管理
        name:'store',
        component:Store,
        children:[
          {
            path:'main_list',
            name:'main_list',
            component: Store_main_list
          },
          {
            path:'sub_list',
            name:'sub_list',
            component: Store_sub_list
          }
        ]
      }
    ]
  },
  {
      path:'/login',
      name:'login',
      component:Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
